// 奇数偶数排序
let arr = [3,4,2,5,9,6]
arr.sort((a,b)=>a-b)
let r =[]

let odd = 1
let even = 0

arr.forEach(item => {
  if(item % 2 === 1){
    r[odd] = item
    odd += 2
  } else {
    r[even] = item
    even += 2
  }
})

console.log(r)